import React, { Component, createContext } from "react";
import Child2 from "./Child2";

export const { Provider, Consumer } = createContext();

class Child extends Component {
  state = {};
  render() {
    return (
      <Provider value={{ name: "tom" }}>
        <div>这是child组件</div>
        <Child2 />
      </Provider>
    );
  }
}

export default Child;
